# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=brutemap
pkgver=65.da4b303
pkgrel=3
pkgdesc="Penetration testing tool that automates testing accounts to the site's login page."
groups=('blackarch' 'blackarch-webapp' 'blackarch-cracker')
arch=('any')
url='https://github.com/brutemap-dev/brutemap'
license=('GPL3')
depends=('python2' 'python2-argparse' 'python2-colorama' 'python2-requests'
         'python2-selenium' 'python2-termcolor' 'geckodriver'
         'python2-backports.shutil_get_terminal_size')
makedepends=('git')
source=("git+https://github.com/brutemap-dev/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.rst \
    CONTRIBUTING.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.rst CONTRIBUTING.md LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

